package com.topsun.framework;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.function.Consumer;

@Slf4j
//@Configuration
public class KafkaStreamListener {
    @Setter
    @Getter
    @AllArgsConstructor
    @NoArgsConstructor
    public static class User{
        private String name;
        private Integer age;
    }

    // 消费者，bean名称必须与配置文件中的bindingName一致
    @Bean
    public Consumer<User> receiver() {
        return msg -> {
            log.info("receive msg:{}", msg);
        };
    }

}
